# Maintainer: Jeremy Tan <jtanx@outlook.com>

_realname=libuninameslist
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=20200413
pkgrel=1
pkgdesc="Library of Unicode annotation data (mingw-w64)"
arch=(any)
url="https://libuninameslist.sourceforge.io/"
license=("BSD")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config")
options=('staticlibs' 'strip')
source=(${_realname}-dist-${pkgver}.tar.gz::https://github.com/fontforge/libuninameslist/releases/download/${pkgver}/libuninameslist-dist-${pkgver}.tar.gz)
sha256sums=('5c0283b2e18d101e58b70a026119d66c9d3e749e4537def7799bba0bc8998f62')

build() {
  [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  cp -rf ${srcdir}/${_realname}-${pkgver} ${srcdir}/build-${MINGW_CHOST}
  cd ${srcdir}/build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-shared \
    --enable-static

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install

  install -Dm644 ${srcdir}/${_realname}-${pkgver}/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}
